package com.homedo.microservice.open.service.gateway.manager.web.gateway.bean.po.enhanced;

import com.homedo.common.dao.bean.po.enhanced.base.BaseEnhanced;
import com.homedo.microservice.open.service.gateway.manager.web.gateway.bean.enums.forrouteserviceurl.StatusEnum4RouteServiceUrl;
import com.homedo.microservice.open.service.gateway.manager.web.gateway.bean.po.RouteServiceUrl;
import org.springframework.beans.BeanUtils;

/**
 * @author 作者 jgshun
 * @date 创建时间 2018年09月18日 11时30分20秒
 */
public class RouteServiceUrlEnhanced extends BaseEnhanced {
    public RouteServiceUrlEnhanced(RouteServiceUrl routeServiceUrl) {

        BeanUtils.copyProperties(routeServiceUrl, this);

        //自动生成 细微误差自己调整

        if (routeServiceUrl.getServiceId() != null) {
            RouteServiceEnhanced routeServiceEnhanced = new RouteServiceEnhanced();
            routeServiceEnhanced.setId(routeServiceUrl.getServiceId());
            this.routeServiceEnhanced = routeServiceEnhanced;
        }
        if (routeServiceUrl.getStatus() != null) {
            this.status = StatusEnum4RouteServiceUrl
                    .getStatusEnumByCode(routeServiceUrl.getStatus().shortValue());
        }
    }

    public RouteServiceUrlEnhanced() {
    }

    private Integer id;
    private RouteServiceEnhanced routeServiceEnhanced;
    private String url;
    private java.util.Date createTime;
    private java.util.Date updateTime;
    private StatusEnum4RouteServiceUrl status;
    private String comment;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public RouteServiceEnhanced getRouteServiceEnhanced() {
        return routeServiceEnhanced;
    }

    public void setRouteServiceEnhanced(RouteServiceEnhanced routeServiceEnhanced) {
        this.routeServiceEnhanced = routeServiceEnhanced;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public java.util.Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(java.util.Date createTime) {
        this.createTime = createTime;
    }

    public java.util.Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(java.util.Date updateTime) {
        this.updateTime = updateTime;
    }

    public StatusEnum4RouteServiceUrl getStatus() {
        return status;
    }

    public void setStatus(StatusEnum4RouteServiceUrl status) {
        this.status = status;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        RouteServiceUrlEnhanced that = (RouteServiceUrlEnhanced) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (routeServiceEnhanced != null ? !routeServiceEnhanced.equals(that.routeServiceEnhanced) : that.routeServiceEnhanced != null)
            return false;
        if (url != null ? !url.equals(that.url) : that.url != null) return false;
        if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) return false;
        if (updateTime != null ? !updateTime.equals(that.updateTime) : that.updateTime != null) return false;
        if (status != that.status) return false;
        return comment != null ? comment.equals(that.comment) : that.comment == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (routeServiceEnhanced != null ? routeServiceEnhanced.hashCode() : 0);
        result = 31 * result + (url != null ? url.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (comment != null ? comment.hashCode() : 0);
        return result;
    }
}